import { Observable } from 'rxjs';
import { EzForm } from '../ez-form';
import { EzFormControlConfiguration } from '../ez-form-control';
import { EzFormGroup } from '../ez-form-group';
import { EzTreeSelect } from './ez-tree-select';

export interface EzTreeSelectOptions {
  label: string;
  key?: string;
  value: any;
  disabled?: boolean;
  isLeaf?: boolean;
  children?: EzTreeSelectOptions[];
}

/**
 * 树形下拉选择器配置项
 */
export interface EzTreeSelectConfiguration extends EzFormControlConfiguration<any, EzTreeSelect> {
  type: 'tree-select';
  options:
    | EzTreeSelectOptions[]
    | ((
        parent: EzTreeSelectOptions,
        control: EzTreeSelect,
        group: EzFormGroup,
        form: EzForm
      ) => Observable<EzTreeSelectOptions[]>);
  maxTagCount?: number;
  checkable?: boolean;
  showLine?: boolean;
  showIcon?: boolean;
  showExpand?: boolean;
  maxTagPlaceholder?: string;
  multiple?: boolean;
}
